There are
rectangles drawn on the plane.
Each rectangle has sides parallel to the coordinate axes and integer coordinates of vertices.
We define a block as follows:
The rectangles in the first figure form two separate blocks.
The rectangles in the second form a single block
Write a program that:
In the first line of the standard input there is an integer
,
,
which is the number of rectangles.
In the following
lines there are coordinates of rectangles.
Each rectangle is described by four numbers: coordinates
of the bottom-left vertex
and coordinates
of the top-right vertex.
All these coordinates are non-negative integers not greater than
.
In the first and only line of the standard output there should be written a single integer — the number of separate blocks formed by the given rectangles.
For the input data:
9 0 3 2 6 4 5 5 7 4 2 6 4 2 0 3 2 5 3 6 4 3 2 5 3 1 4 4 7 0 0 1 4 0 0 4 1
the correct result is:
2
Task author: Wojciech Guzicki.
In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.